package com.tuanbiao.models.action;

import com.abiao.lib_utils.ActivityUtils;
import com.hzjq.core.bean.ErrorResult;
import com.hzjq.data.callback.Callback;
import com.hzjq.lib.ble.BleBus;
import com.tuanbiao.data.callback.OnBaseResultCallback;

import java.io.File;

import timber.log.Timber;

/**
 * @author abiao
 * @date 2022/11/7 15:45
 * @description:
 */
public interface BleBusAction {
    default void importPlan(String path, OnBaseResultCallback<ErrorResult> callback) {
        BleBus.Companion.getDefault().importPlan(new File(path), new Callback<ErrorResult>() {
            @Override
            public void run(ErrorResult errorResult) {
                callback.onSuccess(errorResult);
                callback.onFinish();
                Timber.i("importProject#" + errorResult.getErrorAction());
            }
        });
    }

    default void sharePlan(String planId) {
        BleBus.Companion.getDefault().send(ActivityUtils.getTopActivity(),planId);
    }
}
